class scorePanel {
  private scoreDom: HTMLElement
  private levelDom: HTMLElement
  score: number
  level: number
  constructor(public upScore: number = 10, public maxLevel: number = 10) {
    this.scoreDom = document.getElementById('score')!;
    this.score = Number(this.scoreDom.innerText)
    this.levelDom = document.getElementById('level')!;
    this.level = Number(this.levelDom.innerText)
  }
  addScore() {
    this.scoreDom.innerText = ++this.score + ''
    if (this.score % this.upScore === 0)
      this.levelUp()
  }
  levelUp() {
    if (this.level <= this.maxLevel)
      this.levelDom.innerText = ++this.level + ''
  }
}

export default scorePanel